

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>batch &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../../_static/favicon.ico"/>
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/jquery.js"></script>
        <script src="../../../_static/underscore.js"></script>
        <script src="../../../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../../genindex/" />
    <link rel="search" title="Search" href="../../../search/" />
    <link rel="next" title="加密" href="../encryption/" />
    <link rel="prev" title="activate" href="../activate/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../../" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="../../">ceph-volume</a> &raquo;</li>
        
      <li><code class="docutils literal notranslate"><span class="pre">batch</span></code></li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../../_sources/ceph-volume/lvm/batch.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../../">
          

          
            
            <img src="../../../_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../start/intro/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../">ceph-volume</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="../../#id2">迁移</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../../#id3">全新部署</a></li>
<li class="toctree-l3 current"><a class="reference internal" href="../../#osd">已有 OSD 怎么办</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="../../intro/">Overview</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../intro/#replacing-ceph-disk">Replacing <code class="docutils literal notranslate"><span class="pre">ceph-disk</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../intro/#gpt-partitions-are-simple">GPT partitions are simple?</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../intro/#modularity">Modularity</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../intro/#ceph-volume-lvm"><code class="docutils literal notranslate"><span class="pre">ceph-volume</span> <span class="pre">lvm</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../intro/#lvm-performance-penalty">LVM performance penalty</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../systemd/">systemd</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../inventory/"><code class="docutils literal notranslate"><span class="pre">inventory</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../drive-group/"><code class="docutils literal notranslate"><span class="pre">drive-group</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../"><code class="docutils literal notranslate"><span class="pre">lvm</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../activate/"><code class="docutils literal notranslate"><span class="pre">activate</span></code></a></li>
<li class="toctree-l4 current"><a class="current reference internal" href="#"><code class="docutils literal notranslate"><span class="pre">batch</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#ceph-volume-lvm-batch-report">报表</a></li>
<li class="toctree-l4"><a class="reference internal" href="#sizing">Sizing</a></li>
<li class="toctree-l4"><a class="reference internal" href="#idempotency-and-disk-replacements">Idempotency and disk replacements</a></li>
<li class="toctree-l4"><a class="reference internal" href="../encryption/">加密</a></li>
<li class="toctree-l4"><a class="reference internal" href="../prepare/"><code class="docutils literal notranslate"><span class="pre">prepare</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../create/"><code class="docutils literal notranslate"><span class="pre">create</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../scan/">scan</a></li>
<li class="toctree-l4"><a class="reference internal" href="../systemd/">systemd</a></li>
<li class="toctree-l4"><a class="reference internal" href="../list/"><code class="docutils literal notranslate"><span class="pre">list</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../zap/"><code class="docutils literal notranslate"><span class="pre">zap</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../migrate/"><code class="docutils literal notranslate"><span class="pre">migrate</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../newdb/"><code class="docutils literal notranslate"><span class="pre">new-db</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../newwal/"><code class="docutils literal notranslate"><span class="pre">new-wal</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../simple/"><code class="docutils literal notranslate"><span class="pre">simple</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../simple/activate/"><code class="docutils literal notranslate"><span class="pre">activate</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../simple/scan/"><code class="docutils literal notranslate"><span class="pre">scan</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../simple/systemd/">systemd</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../zfs/"><code class="docutils literal notranslate"><span class="pre">zfs</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../zfs/inventory/"><code class="docutils literal notranslate"><span class="pre">inventory</span></code></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <div class="section" id="batch">
<span id="ceph-volume-lvm-batch"></span><h1><code class="docutils literal notranslate"><span class="pre">batch</span></code><a class="headerlink" href="#batch" title="Permalink to this headline">¶</a></h1>
<p>The subcommand allows to create multiple OSDs at the same time given
an input of devices. The <code class="docutils literal notranslate"><span class="pre">batch</span></code> subcommand is closely related to
drive-groups. One individual drive group specification translates to a single
<code class="docutils literal notranslate"><span class="pre">batch</span></code> invocation.</p>
<p>The subcommand is based to <a class="reference internal" href="../create/#ceph-volume-lvm-create"><span class="std std-ref">create</span></a>, and will use the very
same code path. All <code class="docutils literal notranslate"><span class="pre">batch</span></code> does is to calculate the appropriate sizes of all
volumes and skip over already created volumes.</p>
<p>All the features that <code class="docutils literal notranslate"><span class="pre">ceph-volume</span> <span class="pre">lvm</span> <span class="pre">create</span></code> supports, like <code class="docutils literal notranslate"><span class="pre">dmcrypt</span></code>,
avoiding <code class="docutils literal notranslate"><span class="pre">systemd</span></code> units from starting, defining bluestore or filestore,
are supported.</p>
<div class="section" id="automatic-sorting-of-disks">
<span id="ceph-volume-lvm-batch-bluestore"></span><h2>Automatic sorting of disks<a class="headerlink" href="#automatic-sorting-of-disks" title="Permalink to this headline">¶</a></h2>
<p>If <code class="docutils literal notranslate"><span class="pre">batch</span></code> receives only a single list of data devices and other options are
passed , <code class="docutils literal notranslate"><span class="pre">ceph-volume</span></code> will auto-sort disks by its rotational
property and use non-rotating disks for <code class="docutils literal notranslate"><span class="pre">block.db</span></code> or <code class="docutils literal notranslate"><span class="pre">journal</span></code> depending
on the objectstore used. If all devices are to be used for standalone OSDs,
no matter if rotating or solid state, pass <code class="docutils literal notranslate"><span class="pre">--no-auto</span></code>.
For example assuming <a class="reference internal" href="../../../glossary/#term-bluestore"><span class="xref std std-term">bluestore</span></a> is used and <code class="docutils literal notranslate"><span class="pre">--no-auto</span></code> is not passed,
the deprecated behavior would deploy the following, depending on the devices
passed:</p>
<ol class="arabic simple">
<li><p>Devices are all spinning HDDs: 1 OSD is created per device</p></li>
<li><p>Devices are all SSDs: 2 OSDs are created per device</p></li>
<li><p>Devices are a mix of HDDs and SSDs: data is placed on the spinning device,
the <code class="docutils literal notranslate"><span class="pre">block.db</span></code> is created on the SSD, as large as possible.</p></li>
</ol>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Although operations in <code class="docutils literal notranslate"><span class="pre">ceph-volume</span> <span class="pre">lvm</span> <span class="pre">create</span></code> allow usage of
<code class="docutils literal notranslate"><span class="pre">block.wal</span></code> it isn’t supported with the <code class="docutils literal notranslate"><span class="pre">auto</span></code> behavior.</p>
</div>
<p>This default auto-sorting behavior is now DEPRECATED and will be changed in future releases.
Instead devices are not automatically sorted unless the <code class="docutils literal notranslate"><span class="pre">--auto</span></code> option is passed</p>
<dl class="simple">
<dt>It is recommended to make use of the explicit device lists for <code class="docutils literal notranslate"><span class="pre">block.db</span></code>,</dt><dd><p><code class="docutils literal notranslate"><span class="pre">block.wal</span></code> and <code class="docutils literal notranslate"><span class="pre">journal</span></code>.</p>
</dd>
</dl>
</div>
</div>
<div class="section" id="ceph-volume-lvm-batch-report">
<span id="id1"></span><h1>报表<a class="headerlink" href="#ceph-volume-lvm-batch-report" title="Permalink to this headline">¶</a></h1>
<p>By default <code class="docutils literal notranslate"><span class="pre">batch</span></code> will print a report of the computed OSD layout and ask the
user to confirm. This can be overridden by passing <code class="docutils literal notranslate"><span class="pre">--yes</span></code>.</p>
<p>If one wants to try out several invocations with being asked to deploy
<code class="docutils literal notranslate"><span class="pre">--report</span></code> can be passed. <code class="docutils literal notranslate"><span class="pre">ceph-volume</span></code> will exit after printing the report.</p>
<p>Consider the following invocation:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph-volume lvm batch --report /dev/sdb /dev/sdc /dev/sdd --db-devices /dev/nvme0n1
</pre></div>
</div>
<p>This will deploy three OSDs with external <code class="docutils literal notranslate"><span class="pre">db</span></code> and <code class="docutils literal notranslate"><span class="pre">wal</span></code> volumes on
an NVME device.</p>
<p><strong>易读的报表</strong>
The <code class="docutils literal notranslate"><span class="pre">pretty</span></code> report format (the default) would
look like this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph-volume lvm batch --report /dev/sdb /dev/sdc /dev/sdd --db-devices /dev/nvme0n1
--&gt; passed data devices: 3 physical, 0 LVM
--&gt; relative data size: 1.0
--&gt; passed block_db devices: 1 physical, 0 LVM

Total OSDs: 3

  Type            Path                                                    LV Size         % of device
----------------------------------------------------------------------------------------------------
  data            /dev/sdb                                              300.00 GB         100.00%
  block_db        /dev/nvme0n1                                           66.67 GB         33.33%
----------------------------------------------------------------------------------------------------
  data            /dev/sdc                                              300.00 GB         100.00%
  block_db        /dev/nvme0n1                                           66.67 GB         33.33%
----------------------------------------------------------------------------------------------------
  data            /dev/sdd                                              300.00 GB         100.00%
  block_db        /dev/nvme0n1                                           66.67 GB         33.33%
</pre></div>
</div>
<p><strong>JSON 格式的报表</strong>
Reporting can produce a structured output with <code class="docutils literal notranslate"><span class="pre">--format</span> <span class="pre">json</span></code> or
<code class="docutils literal notranslate"><span class="pre">--format</span> <span class="pre">json-pretty</span></code>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph-volume lvm batch --report --format json-pretty /dev/sdb /dev/sdc /dev/sdd --db-devices /dev/nvme0n1
--&gt; passed data devices: 3 physical, 0 LVM
--&gt; relative data size: 1.0
--&gt; passed block_db devices: 1 physical, 0 LVM
[
    {
        &quot;block_db&quot;: &quot;/dev/nvme0n1&quot;,
        &quot;block_db_size&quot;: &quot;66.67 GB&quot;,
        &quot;data&quot;: &quot;/dev/sdb&quot;,
        &quot;data_size&quot;: &quot;300.00 GB&quot;,
        &quot;encryption&quot;: &quot;None&quot;
    },
    {
        &quot;block_db&quot;: &quot;/dev/nvme0n1&quot;,
        &quot;block_db_size&quot;: &quot;66.67 GB&quot;,
        &quot;data&quot;: &quot;/dev/sdc&quot;,
        &quot;data_size&quot;: &quot;300.00 GB&quot;,
        &quot;encryption&quot;: &quot;None&quot;
    },
    {
        &quot;block_db&quot;: &quot;/dev/nvme0n1&quot;,
        &quot;block_db_size&quot;: &quot;66.67 GB&quot;,
        &quot;data&quot;: &quot;/dev/sdd&quot;,
        &quot;data_size&quot;: &quot;300.00 GB&quot;,
        &quot;encryption&quot;: &quot;None&quot;
    }
]
</pre></div>
</div>
</div>
<div class="section" id="sizing">
<h1>Sizing<a class="headerlink" href="#sizing" title="Permalink to this headline">¶</a></h1>
<p>When no sizing arguments are passed, <cite>ceph-volume</cite> will derive the sizing from
the passed device lists (or the sorted lists when using the automatic sorting).
<cite>ceph-volume batch</cite> will attempt to fully utilize a device’s available capacity.
Relying on automatic sizing is recommended.</p>
<p>If one requires a different sizing policy for wal, db or journal devices,
<cite>ceph-volume</cite> offers implicit and explicit sizing rules.</p>
<div class="section" id="implicit-sizing">
<h2>Implicit sizing<a class="headerlink" href="#implicit-sizing" title="Permalink to this headline">¶</a></h2>
<p>Scenarios in which either devices are under-comitted or not all data devices are
currently ready for use (due to a broken disk for example), one can still rely
on <cite>ceph-volume</cite> automatic sizing.
Users can provide hints to <cite>ceph-volume</cite> as to how many data devices should have
their external volumes on a set of fast devices. These options are:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">--block-db-slots</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--block-wal-slots</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--journal-slots</span></code></p></li>
</ul>
<p>For example, consider an OSD host that is supposed to contain 5 data devices and
one device for wal/db volumes. However, one data device is currently broken and
is being replaced. Instead of calculating the explicit sizes for the wal/db
volume, one can simply call:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph-volume lvm batch --report /dev/sdb /dev/sdc /dev/sdd /dev/sde --db-devices /dev/nvme0n1 --block-db-slots 5
</pre></div>
</div>
</div>
<div class="section" id="explicit-sizing">
<h2>Explicit sizing<a class="headerlink" href="#explicit-sizing" title="Permalink to this headline">¶</a></h2>
<p>It is also possible to provide explicit sizes to <cite>ceph-volume</cite> via the arguments</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">--block-db-size</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--block-wal-size</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--journal-size</span></code></p></li>
</ul>
<p><cite>ceph-volume</cite> will try to satisfy the requested sizes given the passed disks. If
this is not possible, no OSDs will be deployed.</p>
</div>
</div>
<div class="section" id="idempotency-and-disk-replacements">
<h1>Idempotency and disk replacements<a class="headerlink" href="#idempotency-and-disk-replacements" title="Permalink to this headline">¶</a></h1>
<p><cite>ceph-volume lvm batch</cite> intends to be idempotent, i.e. calling the same command
repeatedly must result in the same outcome. For example calling:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph-volume lvm batch --report /dev/sdb /dev/sdc /dev/sdd --db-devices /dev/nvme0n1
</pre></div>
</div>
<p>will result in three deployed OSDs (if all disks were available). Calling this
command again, you will still end up with three OSDs and ceph-volume will exit
with return code 0.</p>
<p>Suppose /dev/sdc goes bad and needs to be replaced. After destroying the OSD and
replacing the hardware, you can again call the same command and <cite>ceph-volume</cite>
will detect that only two out of the three wanted OSDs are setup and re-create
the missing OSD.</p>
<p>This idempotency notion is tightly coupled to and extensively used by <a class="reference internal" href="../../../cephadm/services/osd/#drivegroups"><span class="std std-ref">Advanced OSD Service Specifications</span></a>.</p>
</div>



           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="../encryption/" class="btn btn-neutral float-right" title="加密" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="../activate/" class="btn btn-neutral float-left" title="activate" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).

    </p>
  </div> 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>